#!/bin/sh

# 1.删除旧的PaaS目录
rm -rf PaaS

# 2.从https://gitee.com/luo-pingwei/PaaS.git拉取代码
git clone https://gitee.com/luo-pingwei/PaaS.git

# 3.进入PaaS目录
cd PaaS

# 根据requirements.txt安装依赖
#pip install -r requirements.txt

# 检查是否有python，如果没有则使用python3,运行django项目，并将输出重定向到backend_log.txt
if ! type python >/dev/null 2>&1; then
    python3 manage.py makemigrations
    python3 manage.py migrate
#    python3 manage.py runserver 0.0.0.0:8000 > ../backend_log.txt 2>&1 &
    python3 manage.py runserver 0.0.0.0:8000
else
    python manage.py makemigrations
    python manage.py migrate
#    python manage.py runserver 0.0.0.0:8000 > ../backend_log.txt 2>&1 &
    python manage.py runserver 0.0.0.0:8000
fi

